package com.yoi.SendAndRecv;

import com.rabbitmq.client.Channel;
import com.yoi.bean.Book;
import com.yoi.bean.Ordermessage;
import com.yoi.service.OrderService;
import org.springframework.amqp.rabbit.annotation.*;
import org.springframework.amqp.support.AmqpHeaders;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.handler.annotation.Headers;
import org.springframework.messaging.handler.annotation.Payload;
import org.springframework.stereotype.Component;

import java.util.Map;
import java.util.UUID;
//Version3
/**
 * 接收第一个账户key为hello1的信息 Topic模式 通配符
 */
//@Component
@RabbitListener(bindings=@QueueBinding(value=@Queue(value="First-queue"),
        exchange=@Exchange(name="First-exchange",durable="true",type="topic"), key="hello1.*"),containerFactory = "FirstContainerFactory")
public class Receiver {

    @RabbitHandler
    public void process(@Payload String body, @Headers Map<String,Object> headers, Channel channel) {
        System.out.println("Receiver : " + body);
    }

}